﻿@model FieldControlViewModel
@{ 
	string dataVal = string.Empty;
	string dataValMsg = string.Empty;
	if (Model.EnableNull)
	{
		dataVal += " data-val-required=\"不能为空\" ";
	}
	if (!string.IsNullOrEmpty(dataVal))
	{
		dataVal += " data-val=\"true\" ";
		dataValMsg = " data-valmsg-for=\""+ Model.Prefix + Model.FieldName + "\" data-valmsg-replace=\"true\"";
	}
}
<span class="select-box radius">
	<select class="layui-input" name="@Model.Prefix@Model.FieldName" id="@Model.Prefix@Model.FieldName" @Html.Raw(dataVal) lay-ignore></select>
</span>
<span class="layui-bg-green">@Model.Description</span>
<span style="color:red;" @Html.Raw(dataValMsg)></span>
<script type="text/javascript">
	function @{@Model.Prefix@Model.FieldName}InitListControl() {
		var selectID = "@Model.Prefix@Model.FieldName";
		var data = @Html.Raw(Model.Tips);
		var selectValue = "@Model.FieldValue";
		initSelect2(selectID, data, selectValue, true);
	}
	jQuery(function () {
		@{@Model.Prefix@Model.FieldName}InitListControl();
	});
</script>